let main_box = document.querySelector("#main_box ul");

let url = decodeURI(location.href).split("?")[1].split("=")[1];
console.log(url);

const xhr1 = new XMLHttpRequest();
xhr1.open("get","http://chst.vip:1234/api/getdiscountproduct?productid="+url,true);
xhr1.onload = function(){
    if(xhr1.status === 200){
        let res1 = JSON.parse(xhr1.responseText);
        console.log(res1);
        let main_boxs = "";

        res1.result.forEach(item => {
            main_boxs += `<li>
                            <div class="title">
                                ${item.productName}
                            </div>
                            <div class="from">
                                <span>
                                    ${item.productFrom}&nbsp;|&nbsp;${item.productTime}
                                </span>
                                <span>
                                    ${item.productTips}&nbsp;&nbsp;&nbsp;&nbsp;
                                </span>
                                <p>
                                    ${item.productPrice}
                                </p>
                            </div>
                            <div class="content">
                                <div class="detail">
                                    ${item.productInfo}
                                </div>
                                <div class="img">
                                    ${item.productImg}
                                </div>
                            </div>
                        </li>`
        });
        main_box.innerHTML = main_boxs;

    }
}
xhr1.send(null);




